<template>
	<div class="pageContent"> 
		<!-- 搜索input -->
		<div class="pagesSearch">
			<input class="searchInput" v-model="inputText" @focus="btKeyUp" @blur="btKeydone"  placeholder="请输入企业名称或地址" />
			<div class="searchButton" @click="toSearch()">
				搜索<span><img src="../../../public/images/enterprise/sousuo@2x.png" ></span>
			</div>
		</div>
		<div class="borderList">
		<!-- 产业类型 -->
		<div class="enterType">             
			<div class="enterType_title">
				产业类型：
			</div>
			<!-- 产业类型-新材料 -->
			<div class="enterType_select" v-if="tname=='新材料'">
				<div class="select_top">
					<div class="top_item"><input type="checkbox" v-model="newEnterAll" @change="allAllCheck(newEnterAll)">全部</div>
					<div class="top_item" v-for="item in typeList">
						<input type="checkbox" v-model="item.done" @change="allCheck(item.id,$event)">
						<div class="top_item_button" @click="cMaterial(item.id)">
							<div class="button_text">
								{{item.title}}
							</div>
							<img v-if="materialNum==item.id" src="../../../public/images/enterprise/shang@2x.png" alt="">
							<img v-else src="../../../public/images/enterprise/xia@2x.png" alt="">
						</div>
					</div>
				</div>
				<!-- 先进基础材料数据 -->
				<div class="select_button" v-if="materialNum==0">
					<div class="button_item" v-for="(item,index) of advancedList" :key="index">
						<input type="checkbox" class="button_item_li1" v-model="item.flag" @change="newEnterCheck(materialNum,item.label_name,$event)">{{item.label_name}}
						</div>
				</div>
				<!-- 关键战略材料数据 -->
				<div class="select_button" v-if="materialNum==1">
					<div class="button_item" v-for="(item,index) of strategicList" :key="index">
						<input type="checkbox" class="button_item_li2" v-model="item.flag" @change="newEnterCheck(materialNum,item.label_name,$event)">{{item.label_name}}
						</div>
				</div>
				<!-- 前沿新材料数据 -->
				<div class="select_button" v-if="materialNum==2">
					<div class="button_item" v-for="(item,index) of frontList" :key="index">
						<input type="checkbox" class="button_item_li3" v-model="item.flag" @change="newEnterCheck(materialNum,item.label_name,$event)">{{item.label_name}}
						</div>
				</div>
			</div>
			<!-- 产业类型-稀土永磁 -->
			<div class="enterType_select" v-if="tname=='稀土永磁材料'">
				<div class="select_button">
					<div class="button_item">
						<input type="checkbox" v-model="xituEnterAll" @change="xituAllEnterCheck(xituEnterAll)">全部
					</div>
					<div class="button_item" v-for="(item,index) of xituList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="xituEnterCheck(item.earth,$event)">{{item.earth}}
					</div>
				</div>
			</div>
			<!-- 产业类型-磁性材料 -->
			<div class="enterType_select" v-if="tname=='磁性材料'">
				<div class="select_button">
					<div class="button_item">
						<input type="checkbox" v-model="cixEnterAll" @change="cixAllEnterCheck(cixEnterAll)">全部
					</div>
					<div class="button_item" v-for="(item,index) of cixingList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="cixEnterCheck(item.ferrites,$event)">{{item.ferrites}}
					</div>
				</div>
			</div>
		</div>
		

		<!-- 地域分布 -->
		<div class="terrain">
			<div class="terrain_title">
				地域分布： 
			</div>
			<div class="terrain_select">
				<!-- 省 -->
				<div class="top_item">
					<el-select v-model="pname" placeholder="省" @change="provinceChange" @visible-change="visibleChange($event,0)" popper-class="popper" :popper-append-to-body="false">
						 <template slot="prefix">
							 <span>
							 	<img src="../../../public/images/enterprise/shang@2x.png" 
								:style="'transform: rotateZ('+ rotateZ[0] + 'deg)'">
							</span>
						</template>
						<el-option
							v-for="item2 in province"
							:key="item2.id"
							:label="item2.value"
							:value="item2.id"
							class="button_text">
						</el-option>
					</el-select>
				</div>
				<!-- 市 -->
				<div class="top_item">
					<el-select v-model="cname" placeholder="市" @change="cityChange" @visible-change="visibleChange($event,1)" popper-class="popper" :popper-append-to-body="false">
						<template slot="prefix">
							<span>
								<img src="../../../public/images/enterprise/shang@2x.png" 
								:style="'transform: rotateZ('+ rotateZ[1] + 'deg)'">
							</span>
						</template>
						<el-option
							v-for="item2 in city"
							:key="item2.id"
							:label="item2.value"
							:value="item2.id"
							class="button_text">
						</el-option>
					</el-select>
				</div>
				<!-- 区(县)-->
				<div class="top_item">
					<el-select v-model="bname" placeholder="区(县)" @change="blockChange" @visible-change="visibleChange($event,2)" popper-class="popper" :popper-append-to-body="false">
						<template slot="prefix">
							<span>
								<img src="../../../public/images/enterprise/shang@2x.png" 
								:style="'transform: rotateZ('+ rotateZ[2] + 'deg)'">
							</span>
						</template>
						<el-option
							v-for="item2 in block"
							:key="item2.id"
							:label="item2.value"
							:value="item2.value"
							class="button_text">
						</el-option>
					</el-select>
				</div>
				
			</div>
			<!-- <div class="sureList"> -->
				<!-- <div class="select_button">
					<div class="button_item">
						<input type="checkbox" :checked="terrainAll"> 全部
					</div>
					<div class="button_item" v-for="(item,index) of areaList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="terrainCheck(item.area,$event)"> {{item.area}}
					</div>
				</div> -->
		</div>

			<!-- 企业资质 -->
		<div class="honey">
			<div class="honey_title">
				企业资质： 
			</div>
			<div class="honey_select">
				<div class="select_button">
					<div class="button_item">
						<input type="checkbox"  v-model="honeyAll"  @change="honeyAllCheck(honeyAll)">全部
					</div>
					<div class="button_item" v-for="(item,index) of mappingList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="honeyCheck(item.qualified_name,$event)">{{item.qualified_name}}
					</div>
				</div>
			</div>
		</div>

		<!-- 注册资本 -->
		<div class="capital">
			<div class="capital_title">
				注册资本： 
			</div>
			<div class="capital_select">
				<div class="select_button">
					<div class="button_item">
						<input type="checkbox" v-model="capitalAll"  @change="capitalAllCheck(capitalAll)">全部
					</div>
					<div class="button_item" v-for="(item,index) of capitalList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="capitalCheck(index+1,$event)">{{item.regcapital_amt_range}}
					</div>
				</div>
			</div>
		</div>
		<!-- 营业收入 -->
		<div class="operaIncome">
			<div class="operaIncome_title">
				营业收入： 
			</div>
			<div class="operaIncome_select">
				<div class="select_top">
					<div class="button_item">
						<input type="checkbox" v-model="operayearAll"  @change="operayearAllCheck(operayearAll)">全部
						</div>
					<div class="button_item" v-for="(item,index) of operayearList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="operayearCheck(item.report_date,$event)">{{item.report_date}}年
					</div>
					<!-- <div class="button_item"><input type="checkbox">2019年</div>
					<div class="button_item"><input type="checkbox">2018年</div> -->
				</div>
				<div class="select_button">
					<div class="button_item">
						<input type="checkbox" v-model="operaAll"  @change="operaAllCheck(operaAll)">全部
					</div>
					<div class="button_item" v-for="(item,index) of incomeList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="operaCheck(index+1,$event)">{{item.sales_range}}
					</div>
				</div>
			</div>
		</div>
		<!-- 成立日期 -->
		<div class="establish">
			<div class="establish_title">
				成立日期： 
			</div>
			<el-select v-model="updataName" placeholder="全部" @change="updataChange" @visible-change="visibleChange($event,3)" popper-class="popper" :popper-append-to-body="false">
					<template slot="prefix">
						<span>
							<img src="../../../public/images/enterprise/shang@2x.png" 
								:style="'transform: rotateZ('+ rotateZ[3] + 'deg)'">
						</span>
					</template>
				<el-option
					v-for="item2 in updataList"
					:key="item2.id"
					:label="item2.value"
					:value="item2.value"
					class="button_text">
				</el-option>
			</el-select>
		</div>

		<!-- 纳税金额 -->
		<div class="taxLiability">
			<div class="taxLiability_title">
				纳税金额： 
			</div>
			<div class="taxLiability_select">
				<div class="select_top">
					<div class="button_item">
						<input type="checkbox" v-model="taxyearAll"  @change="taxyearAllCheck(taxyearAll)">全部
						</div>
					<div class="button_item" v-for="(item,index) of taxyearList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="taxyearCheck(item.report_date,$event)">{{item.report_date}}年
					</div>
				</div>
				<div class="select_button">
					<div class="button_item">
						<input type="checkbox" v-model="taxAll"  @change="taxAllCheck(taxAll)">全部
					</div>
					<div class="button_item" v-for="(item,index) of taxList" :key="index">
						<input type="checkbox" v-model="item.flag" @change="taxCheck(index+1,$event)">{{item.tax_range}}
					</div>
				</div>
			</div>
		</div>
		</div>
		<div class="sureList">
			<div class="sureButton" @click="confirmSelect()">
				确定查询
			</div>
		</div>
	</div>
</template>

<script>
	export default{
		data() {
			return{
				rotateZ: [180,180,180,180],
				// establish: '',
				province:[],//省
				pname:'',//省名
				city:[],//市
				cname:'',//市名
				block:[],//区级
				bname:'',//区级名
				pnameid:'',//省名code
				cnameid:'',//市名code
				bnameid:'',//区级名code
				advancedList:[],//先进基础材料
				strategicList:[],//先关键战略材料
				frontList:[],//前沿新材料
				xclrootName:'',
				typeList:[
					{"id":0,title:'先进基础材料',"done":true},//先进基础材料选择框
					{"id":1,title:'关键战略材料',"done":true},//先关键战略材料选择框
					{"id":2,title:'前沿新材料',"done":true},//前沿新材料选择框
				],
				materialNum:0, //当前材料下标
				cixingList:[
					{"ferrites":"软磁材料","flag":true},
					{"ferrites":"永磁材料","flag":true},
					{"ferrites":"矩磁材料","flag":true},
					{"ferrites":"压磁材料","flag":true},
					{"ferrites":"旋磁材料","flag":true},
				],//磁性材料数据
				xituList:[
					{"earth":"钐钴永磁","flag":true},
					{"earth":"钕铁硼永磁","flag":true},
					{"earth":"高丰度稀土永磁","flag":true},
					{"earth":"铁氮永磁","flag":true},
					{"earth":"稀土铁碳永磁","flag":true},
					{"earth":"磁组件","flag":true},
				],//磁性材料数据
				mappingList:[], //企业资质数据
				areaList:[],	//地域分布数据
				capitalList:[], //注册资本数据
				incomeList:[],	//营业收入数据
				operayearList:[],//营业收入年份数据
				updataList:[],//成立日期
				updataName:'',
				taxyearList:[],//纳税金额年份数据
				taxList:[],//纳税金额数据
				inputText:'',//文本框输入
				newEnterAll:true,//产业类型新材料全部
				xituEnterAll:true,//产业类型稀土永磁全部
				cixEnterAll:true,//产业类型磁性材料全部
				honeyAll:true,//企业资质全部
				terrainAll:true,//地域分布全部
				capitalAll:true,//注册资本全部
				operayearAll:true,//营业收入年限全部
				operaAll:true,//营业收入全部
				taxyearAll:true,//纳税金额年限全部
				taxAll:true,//纳税金额全部
				newEnterSelected:[],//新材料产业类型选中
				newxianSelected:[],//新材料产业类型先进基础材料选中
				newguanSelected:[],//新材料产业类型关键战略材料选中
				newqianSelected:[],//新材料产业类型前沿新材料选中
				xituEnterSelected:[],//稀土永磁产业类型选中
				cixEnterSelected:[],//磁性材料产业类型选中
				honeySelected:[],//企业资质选中
				areaSelected:[],//地域分布选中
				capitalSelected:[],//注册资本选中
				operayearSelected:[],//营业收入年限选中
				operaSelected:[],//营业收入选中
				
				taxyearSelected:[],//纳税金额年限选中
				taxSelected:[],//纳税金额选中
				tname:'新材料',
				xjinData:[],
				amtSort:'desc',
				dataSort:''
			}
		},
		watch:{
			inputText(newValue, oldValue){
				this.inputText = newValue.replace(/[^a-zA-Z0-9\u4E00-\u9FA5]/g, "")
			},
			  pname(newValue, oldValue){
				if(newValue=='浙江省'){
					this.zjMapping()
				}else{
					this.qgMapping()
				}
			},
			//新材料产业类型
			typeList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].done==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.newEnterAll=true
					}else{
						this.newEnterAll=false
					}
				},
				deep:true
			},
			// 先进基础材料
			advancedList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.newxianSelected=['全部']
						this.typeList[0].done=true
					}else{
						this.typeList[0].done=false
					}
					if(count==0){
						this.newxianSelected=[]
					}
				},
				deep:true
			},
			// 关键战略材料
			strategicList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.newguanSelected=['全部']
						this.typeList[1].done=true
					}else{
						this.typeList[1].done=false
					}
					if(count==0){
						this.newguanSelected=[]
					}
				},
				deep:true
			},
			// 前沿新材料
			frontList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.newqianSelected=['全部']
						this.typeList[2].done=true
					}else{
						this.typeList[2].done=false
					}
					if(count==0){
						this.newqianSelected=[]
					}
				},
				deep:true
			},
			//稀土永磁产业类型
			xituList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.xituEnterSelected=[]
						this.xituEnterAll=true
					}else{
						this.xituEnterAll=false
					}
				},
				deep:true
			},
			//磁性材料产业类型
			cixingList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.cixEnterSelected=[]
						this.cixEnterAll=true
					}else{
						this.cixEnterAll=false
					}
				},
				deep:true
			},
			// 企业资质
			mappingList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.honeySelected=[]
						this.honeyAll=true
					}else{
						this.honeyAll=false
					}
				},
				deep:true
			},
			//注册资本
			capitalList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.capitalSelected=[]
						this.capitalAll=true
					}else{
						this.capitalAll=false
					}
				},
				deep:true
			},
			//营业收入年限
			operayearList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.operayearSelected=[]
						this.operayearAll=true
					}else{
						this.operayearAll=false
					}
				},
				deep:true
			},
			//营业收入金额
			incomeList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.operaSelected=[]
						this.operaAll=true
					}else{
						this.operaAll=false
					}
				},
				deep:true
			},
			//纳税金额年限
			taxyearList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.taxyearSelected=[]
						this.taxyearAll=true
					}else{
						this.taxyearAll=false
					}
				},
				deep:true
			},
			//纳税金额
			taxList:{
				handler(value){
					var count=0;
					for(var i=0;i<value.length;i++){
						if(value[i].flag==true){
					          count++;
					    }
					}
					if(count==value.length){
						this.taxSelected=[]
						this.taxAll=true
					}else{
						this.taxAll=false
					}
				},
				deep:true
			},
		},
		created() {
			this.getAdvancedList(),
			this.getTname()
			ue.interface.transList = this.trans
			this.getSort()
			// this.getCityData()
		},
		methods:{
			async trans(data){
				let res = await this.getData(data)
				this.inputText= res
				this.toSearch()
			},
			getData(data){
				let res= JSON.stringify(data)
				res=JSON.parse(res)
				return res
			 },
			btKeyUp(){
				this.$ue4('startInput',true)
			},
			btKeydone(){
				this.$ue4('startInput',false)
			},
			// async getCityData(){
			// 	const res = await this.$api.post('dcockpit/rest/nbCockpitApi/getAreaList')
			// 	console.log(res)
			// },
			visibleChange(isV, index){
				
				if(isV){
					this.$set(this.rotateZ, index, 180)
				} else {
					this.$set(this.rotateZ, index, 0)
				}
				// console.log(isV, this.rotateZ)
			},
			// 获取当前材料名
			getTname(){
				this.$bus.$on('upTname',item=>{
					
					this.tname=item
					this.getReduction()
				})
			},
			// 获取排序
			getSort(){
				this.$bus.$on('updateSort',(aSort,dSort)=>{
					console.log('amtSort',aSort,'dataSort',dSort)
					this.amtSort=aSort
					this.dataSort=dSort
					this.confirmSelect()
				})
			},
			// 搜索指定公司
			async toSearch(){
				
				var dt = {
					// "params": {
					// 	"normGuid": "b55cbf6d-df81-46fb-93d7-7678bd089471",
					// 		"fieldList": [{
					//             "key":"company_name",
					//             "value":this.inputText.trim()
					//         }],
					// }
					"company":this.inputText.trim()
				};
				const aaa = await this.$api.post('dcockpit/rest/nbCockpitApi/searchEnterprisePortraitListV2', dt)
				let {custom:{result}}={...aaa}
				let searchData=result.list
				let sumCount=result.count
				this.$bus.$emit('updateListData',searchData,sumCount)
				this.inputText=''
			},
			allFalse(result,name){
				let allList=result.cockpitData
				allList.forEach((value,index)=>{
					value['flag']=true
				})
				switch(name){
					case 'advanced':
						this.advancedList=allList
						break;
					case 'strategic':
						this.strategicList=allList
						break;
					case 'front':
						this.frontList=allList
						break;
					case 'mapping':
						this.mappingList=allList
						break;
					case 'area':
						this.areaList=allList
						break;
					case 'capital':
						this.capitalList=allList
						break;
					case 'operayear':
						this.operayearList=allList
						break;
					case 'income':
						this.incomeList=allList
						break;
					case 'taxyear':
						this.taxyearList=allList
						break;
					case 'tax':
						this.taxList=allList
						break;
				}
			},
			//获取选框内容
			async getAdvancedList(){
				// 获取先进基础材料详情
				var dt = {
					"params": {
						"normGuid": "819856c3-bb9c-45a7-87b4-6a96d47664e7",
							"fieldList": [{"key":"mapping_name","value":"先进基础材料"}]
						}
				};
				const advancedData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt)
				let {custom:{result}}={...advancedData}
				this.allFalse(result,'advanced')
				// 获取关键战略料详情
				var dt1 = {
					"params": {
						"normGuid": "819856c3-bb9c-45a7-87b4-6a96d47664e7",
							"fieldList": [{"key":"mapping_name","value":"关键战略材料"}]
						}
				};
				const strategicData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt1)
				let {custom:{result:resultGic}}={...strategicData}
				this.allFalse(resultGic,'strategic')
				// 获取前沿新材料详情
				var dt2 = {
					"params": {
						"normGuid": "819856c3-bb9c-45a7-87b4-6a96d47664e7",
							"fieldList": [{"key":"mapping_name","value":"前沿新材料"}]
						}
				};
				const frontData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt2)
				let {custom:{result:resultFront}}={...frontData}
				this.allFalse(resultFront,'front')
				// 获取企业资质详情
				var dt3 = {
					"params": {
							"normGuid": "1eed57b2-b090-47ac-bcb1-9851a72a877d",
							"fieldList": [{"key":"iscountry","value":"1"}]
						}
				};
				const mappingData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt3)
				let {custom:{result:resultMapping}}={...mappingData}
				this.allFalse(resultMapping,'mapping')
				// 获取地域分布详情
				// var dt4 = {
				// 	"params": {
				// 			"normGuid": "b6954d55-af27-4e28-8661-fd963d4b3ae5",
				// 			"fieldList": []
				// 		}
				// };
				// const areaData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt4)
				// let {custom:{result:resultArea}}={...areaData}
				// this.allFalse(resultArea,'area')
				// 获取地域分布详情2
				const areaData = await this.$api.post('dcockpit/rest/nbCockpitApi/getAreaList')
				areaData.data.forEach((item,index)=>{
					this.province.push({
						id:item.code,
						value:item.name,
						child:item.child
					})
				})
				// 获取注册资本详情
				var dt5 = {
					"params": {
							"normGuid": "097b3464-673d-46af-b9ae-31a3322a22c3",
							"fieldList": []
						}
				};
				const capitalData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt5)
				let {custom:{result:resultCapital}}={...capitalData}
				this.allFalse(resultCapital,'capital')
				// 获取营业收入年限详情
				var dt6 = {
					"params": {
							"normGuid": "a6179153-1407-49d5-9025-57c9ce47fe1a",
							"fieldList": []
						}
				};
				const operayearData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt6)
				let {custom:{result:resultOperayear}}={...operayearData}
				this.allFalse(resultOperayear,'operayear')
				// 获取营业收入详情
				var dt7 = {
					"params": {
							"normGuid": "ec93bd4a-43d7-4720-84d9-499ff9e173c9",
							"fieldList": []
						}
				};
				const incomeData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt7)
				let {custom:{result:resultIncome}}={...incomeData}
				this.allFalse(resultIncome,'income')
				//成立日期
				var dt8 = {
					"params": {
							"normGuid": "ed6b8c57-894a-4fa0-8482-c858158cec1c",
							"fieldList": []
						}
				};
				const updataData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt8)
				let {custom:{result:resultUpdata}}={...updataData}
				resultUpdata.cockpitData.forEach((item,index)=>{
					this.updataList.push({
						id:index,
						value:item.found_date
					})
				})
				// 获取纳税金额年限详情
				var dt9 = {
					"params": {
							"normGuid": "232bf1e8-b75e-4225-9fad-a2fe4958a1bf",
							"fieldList": []
						}
				};
				const taxyearData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt9)
				let {custom:{result:resultTaxyear}}={...taxyearData}
				this.allFalse(resultTaxyear,'taxyear')
				// 获取纳税金额详情
				var dt10 = {
					"params": {
							"normGuid": "f346666d-f60c-4ef9-b035-f1fb84bf9f64",
							"fieldList": []
						}
				};
				const taxData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt10)
				let {custom:{result:resultTax}}={...taxData}
				this.allFalse(resultTax,'tax')
				
			},
			// 改变当前材料数据
			cMaterial(cnum){
				this.materialNum=cnum
			},
			//新材料产业类型选中
			newEnterCheck(num,nname,e){
				switch(num){
					case 0:
					if(e.target.checked==true){
						
						this.newxianSelected.push(nname)
					}else{
						this.newxianSelected.splice(this.newxianSelected.findIndex(item=>item===nname),1)
					}
					this.advancedList.forEach(item => {
						if(item.flag==true){
							this.newxianSelected.push(item.label_name)
						}
					})
					this.newxianSelected=[...new Set(this.newxianSelected)]
						break;
					case 1:
					if(e.target.checked==true){
						
						this.newguanSelected.push(nname)
					}else{
						this.newguanSelected.splice(this.newguanSelected.findIndex(item=>item===nname),1)
					}
					this.strategicList.forEach(item => {
						if(item.flag==true){
							this.newguanSelected.push(item.label_name)
						}
					})
					this.newguanSelected=[...new Set(this.newguanSelected)]
						break;
					case 2:
					if(e.target.checked==true){
						
						this.newqianSelected.push(nname)
					}else{
						this.newqianSelected.splice(this.newqianSelected.findIndex(item=>item===nname),1)
					}
					this.frontList.forEach(item => {
						if(item.flag==true){
							this.newqianSelected.push(item.label_name)
						}
					})
					this.newqianSelected=[...new Set(this.newqianSelected)]
						break;
				}
			},
			//新材料产业类型全部
			allAllCheck(check){
				this.typeList.forEach(item=>item.done=check)
				this.advancedList.forEach(item=>item.flag=check)
				this.strategicList.forEach(item=>item.flag=check)
				this.frontList.forEach(item=>item.flag=check)
			},
			//稀土永磁产业类型全部
			xituAllEnterCheck(check){
				this.xituList.forEach(item=>item.flag=check)
			},
			//磁性材料产业类型全部
			cixAllEnterCheck(check){
				this.cixingList.forEach(item=>item.flag=check)
			},
			//新材料产业类型先进基础材料选中
			allCheck(id,e){
				switch(id){
					case 0:
					this.advancedList.forEach(item=>item.flag=e.target.checked)
						break;
					case 1:
					this.strategicList.forEach(item=>item.flag=e.target.checked)
						break;
					case 2:
					this.frontList.forEach(item=>item.flag=e.target.checked)
						break;
				}
			},
			
			//稀土永磁产业类型选中
			xituEnterCheck(xname,e){
				if(e.target.checked==true){
					this.xituEnterSelected.push(xname)
				}else{
					this.xituEnterSelected.splice(this.xituEnterSelected.findIndex(item=>item===xname),1)
				}
				this.xituList.forEach(item => {
					if(item.flag==true){
						this.xituEnterSelected.push(item.earth)
					}
				})
				this.xituEnterSelected=[...new Set(this.xituEnterSelected)]
				// console.log(this.xituEnterSelected)
			},
			//磁性材料产业类型选中
			cixEnterCheck(cxname,e){
				
				if(e.target.checked==true){
					this.cixEnterSelected.push(cxname)
				}else{
					this.cixEnterSelected.splice(this.cixEnterSelected.findIndex(item=>item===cxname),1)
				}
				this.cixingList.forEach(item => {
					if(item.flag==true){
						this.cixEnterSelected.push(item.ferrites)
					}
				})
				this.cixEnterSelected=[...new Set(this.cixEnterSelected)]
				// console.log(this.cixEnterSelected)
			},
			// 企业资质全选按钮
			honeyAllCheck(check){
					this.mappingList.forEach(item=>item.flag=check)
			},
			//企业资质选中
			honeyCheck(cname,e){
				if(e.target.checked==true){
					if(cname=='规上企业'){
						cname='规上'
					}
					this.honeySelected.push(cname)
				}else{
					this.honeySelected.splice(this.honeySelected.findIndex(item=>item===cname),1)
				}
				this.mappingList.forEach(item => {
					
					if(item.flag==true){
						
						let name = item.qualified_name
						if(name=='规上企业'){
							name='规上'
						}
						this.honeySelected.push(name)
					}
				})
				this.honeySelected=[...new Set(this.honeySelected)]
				 // console.log(this.honeySelected)
			},
			//地域分布选中
			terrainCheck(carea,e){
				if(e.target.checked==true){
					this.areaSelected.push(carea)
				}else{
					this.areaSelected.splice(this.areaSelected.findIndex(item=>item===carea),1)
				}
				this.terrainAll=false
			},
			 // 选省
			provinceChange(e){
				let shi1=[]
				this.city = [];
				this.block = [];
				this.cname = "";
				this.bname = "";
				this.cnameid="";
				this.bnameid = "";
				for(var index2 in this.province){
					if(e==this.province[index2].id){
						shi1=this.province[index2].child
						this.pname=this.province[index2].value
						this.pnameid=this.province[index2].id
						shi1.forEach(item=>{
							this.city.push({
								id:item.code,
								value:item.name,
								child:item.child
							})
						})
					}
				}
				
			},
			// 选市
			cityChange(e){
				let shi1=[]
				this.block = [];
				this.bname = "";
				for(var index2 in this.city){
					if(e==this.city[index2].id){
						shi1=this.city[index2].child
						this.cname=this.city[index2].value
						this.cnameid=this.city[index2].id
						shi1.forEach(item=>{
							this.block.push({
								id:item.code,
								value:item.name,
								child:[]
							})
						})
					}
				}
			},
			// 选区
			blockChange(e){
				for(var index2 in this.block){
					if(e==this.block[index2].value){
						this.bname=e
						this.bnameid=this.city[index2].id
					}
				}
				
				
			},
			//注册资本全选
			capitalAllCheck(check){
				this.capitalList.forEach(item=>item.flag=check)
			},
			//注册资本选中
			capitalCheck(capitalId,e){
				if(e.target.checked==true){
					this.capitalSelected.push(capitalId)
				}else{
					this.capitalSelected.splice(this.capitalSelected.findIndex(item=>item===capitalId),1)
				}
				this.capitalList.forEach((item,index) => {
					if(item.flag==true){
						this.capitalSelected.push(index+1)
					}
				})
				this.capitalSelected=[...new Set(this.capitalSelected)]	
			},
			// 营业收入年限全选
			operayearAllCheck(check){
				this.operayearList.forEach(item=>item.flag=check)
			},
			// 营业收入年限选中
			operayearCheck(operayId,e){
				if(e.target.checked==true){
					this.operayearSelected.push(operayId)
				}else{
					this.operayearSelected.splice(this.operayearSelected.findIndex(item=>item===operayId),1)
				}
				
				this.operayearList.forEach(item => {
					if(item.flag==true){
						this.operayearSelected.push(item.report_date)
					}
				})
				this.operayearSelected=[...new Set(this.operayearSelected)]	
				// console.log(this.operayearSelected)
			},
			// 营业收入金额全部
			operaAllCheck(check){
				this.incomeList.forEach(item=>item.flag=check)
			},
			// 营业收入金额
			operaCheck(operaId,e){
				if(e.target.checked==true){
					this.operaSelected.push(operaId)
				}else{
					this.operaSelected.splice(this.operaSelected.findIndex(item=>item===operaId),1)
				}
				this.incomeList.forEach((item,index) => {
					if(item.flag==true){
						this.operaSelected.push(index+1)
					}
				})
				this.operaSelected=[...new Set(this.operaSelected)]	
				// console.log(this.operaSelected)
			},
			// 成立日期
			updataChange(e){
				this.updataName=e
			},
			// 纳税金额年限全部
			taxyearAllCheck(check){
				this.taxyearList.forEach(item=>item.flag=check)
			},
			// 纳税金额年限
			taxyearCheck(taxyId,e){
				if(e.target.checked==true){
					this.taxyearSelected.push(taxyId)
				}else{
					this.taxyearSelected.splice(this.taxyearSelected.findIndex(item=>item===taxyId),1)
				}
				this.taxyearList.forEach(item => {
					if(item.flag==true){
						this.taxyearSelected.push(item.report_date)
					}
				})
				this.taxyearSelected=[...new Set(this.taxyearSelected)]	
				// console.log(this.taxyearSelected)
			},
			// 纳税金额全部
			taxAllCheck(check){
				this.taxList.forEach(item=>item.flag=check)
			},
			// 纳税金额金额
			taxCheck(taxId,e){
				if(e.target.checked==true){
					this.taxSelected.push(taxId)
				}else{
					this.taxSelected.splice(this.taxSelected.findIndex(item=>item===taxId),1)
				}
				this.taxList.forEach((item,index) => {
					if(item.flag==true){
						this.taxSelected.push(index+1)
					}
				})
				this.taxSelected=[...new Set(this.taxSelected)]	
				// console.log(this.taxSelected)
			},
			async confirmSelect(){
				this.$bus.$emit('updateListData',[],0)
				let judgeName=''
				switch(this.tname){
					case '稀土永磁材料':
						judgeName=this.xituEnterSelected.join(",")
						this.newxianSelected=['全部']
						this.newguanSelected=['全部']
						this.newqianSelected=['全部']
						break;
					case '磁性材料':
						judgeName=this.cixEnterSelected.join(",")
						this.newxianSelected=['全部']
						this.newguanSelected=['全部']
						this.newqianSelected=['全部']
						break;
					default:
						judgeName=''
				}
				var dt = {
					"mappingName":this.tname,
					"labelClNames":judgeName,
					"xjlabels": this.newxianSelected.join(","),
					"gjlabels": this.newguanSelected.join(","),
					"qylabels": this.newqianSelected.join(","),
					"provincecode":this.pnameid,
					"citycode":this.cnameid,
					"countycode":this.bnameid,
					"qualifiedNames":this.honeySelected.join(","),
					"regcapitalAmts":this.capitalSelected.join(","),
					"yysrYears":this.operayearSelected.join(","),
					"sales":this.operaSelected.join(","),
					"foundDate":this.updataName,
					"reportDates":this.taxyearSelected.join(","),
					"taxs":this.taxSelected.join(","),
					"regcapitalAmtSort":this.amtSort,
					"foundDateSort":this.dataSort
				};
				
				this.$bus.$emit('loadingData','true')
				const aaa = await this.$api.post('dcockpit/rest/nbCockpitApi/searchEnterprisePortraitListV2', dt)
				let {custom:{result}}={...aaa}
				let count=result.count
				let cxallData=result.list
				this.$bus.$emit('updateListData',cxallData,count)
			},
			// 将先进材料下面的数给成true
			getadvancedFalse(){
				this.advancedList.forEach(item=>item.flag=true)
			},
			// 将关键战略材料下面的数给成true
			getstrategicFalse(){
				this.strategicList.forEach(item=>item.flag=true)
			},
			// 将前沿新材料下面的数给成true
			getfrontFalse(){
				this.frontList.forEach(item=>item.flag=true)
			},
			// 切换卡片数据还原最初状态
			getReduction(){
				
				// 新材料
				this.advancedList.forEach(item=>item.flag=true)
				this.strategicList.forEach(item=>item.flag=true)
				this.frontList.forEach(item=>item.flag=true)
				// 磁性材料
				this.cixingList.forEach(item=>item.flag=true)
				// 稀土永磁
				this.xituList.forEach(item=>item.flag=true)
				// console.log(this.province)
				this.pname=''
				this.cname=''
				this.bname=''
				this.pnameid=''
				this.cnameid=''
				this.bnameid=''
				this.mappingList.forEach(item=>item.flag=true)
				this.capitalList.forEach(item=>item.flag=true)
				this.operayearList.forEach(item=>item.flag=true)
				this.incomeList.forEach(item=>item.flag=true)
				this.updataName=''
				this.taxyearList.forEach(item=>item.flag=true)
				this.taxList.forEach(item=>item.flag=true)
				
				this.newxianSelected=['全部']
				this.newguanSelected=['全部']
				this.newqianSelected=['全部']
				this.xituEnterSelected=[]
				this.cixEnterSelected=[]
				
				this.honeySelected=[]
				this.capitalSelected=[]
				this.operayearSelected=[]
				this.operaSelected=[]
				this.taxyearSelected=[]
				this.taxSelected=[]
				
			},
			// 企业资质浙江
			async zjMapping(){
				let dt3 = {
					"params": {
							"normGuid": "1eed57b2-b090-47ac-bcb1-9851a72a877d",
							"fieldList": []
						}
				};
				const mappingData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt3)
				let {custom:{result:resultMapping}}={...mappingData}
				this.allFalse(resultMapping,'mapping')
			},
			async qgMapping(){
				let dt3 = {
					"params": {
							"normGuid": "1eed57b2-b090-47ac-bcb1-9851a72a877d",
							"fieldList": [{"key":"iscountry","value":"1"}]
						}
				};
				const mappingData = await this.$api.post('dcockpit/rest/cockpitApi/searchListNormResult', dt3)
				let {custom:{result:resultMapping}}={...mappingData}
				this.allFalse(resultMapping,'mapping')
			}
		}
	}
</script>

<style lang="stylus" rel='stylesheet/stylus' scoped>
	@import "~@/assets/pageContent.styl"
	.terrain_select {
		display: flex;
		// height: 56px;
		// box-sizing: border-box;
		// box-sizing: content-box;
		.top_item {
			// height: 27px;
			margin-right: 22px;
		}
	}
	>>> .el-input__suffix {
		display: none;
	}
	>>> .el-input__inner {
		max-width: 125px
		padding: 0 22px 0 14px;
		height: 27px;
		background: #043f7a;
		border: 1px solid #2e97ff;
		border-radius: 4px;
		// cursor: pointer;
		font-size: 17px;
		font-family: 'SourceHanSansCN-Regular';
		line-height: 24px;
		color: #FFFFFF;
		text-align: center;
	}
	>>> .popper{
		width: auto;
		margin: 0;
		z-index: 99999;
		background-color: #03274a;
		border: 0;
		.popper__arrow {
			display: none;	
		}
		.el-select-dropdown__item {
			padding: 0 5px;
			text-align: center;
			font-size: 15px !important;
			// color: #C1E2FF !important;
			color: #FFFFFF !important;

			height: 19px !important;
			line-height: 19px !important;
			margin: 8px 0 !important;
		}
		.hover, .selected {
			color: #409eff !important;
			background-color: #03274a !important;
			font-weight: 400;
		}
	}
	>>> .el-input__inner::placeholder {
		color: #fff;
	}
	>>> .el-select-dropdown__wrap{
		max-height: 164px;
		margin-right: -21px !important;
	}
	>>> .el-input__prefix {
		width 8px;
		height 5px;
		left: auto;
		right: 8px;
		img{
			position relative
			width 8px;
			height 5px;
			top: 25%;
			text-align: center;
			color: #C0C4CC;
			font-size: 14px;
			transition: transform .3s;
			cursor: pointer;
		}
	}
	.establish {
		margin-left 11px;
		width 798px;
		height 40px;
		display flex;
		margin-top 15px;
		margin-bottom 29px;
		border-bottom 1px solid #0A2550;

		.establish_title{
			// margin-top 8px;
			width 100px;
			text-align right;
			font-size 17px;
			font-family SourceHanSansCN-Regular;
			color #859BBC;
		}
	}

</style>

